import { ItemData } from "../../../../resource/info/ItemData";
import { ECareer } from "../../../../../../Message/Public/ECareer";
import { Cache } from "../../../../cache/Cache";
import { SecondCareerUtil } from "../../../secondCareer/util/SecondCareerUtil";
import { CareerUtil } from "../../util/CareerUtil";
type int = number;
//class RuneToolTipUtil
    
    export  class RuneToolTipUtil
    {
        

        public static getSameTypeRuneEquiped(arg1: ItemData): ItemData
        {
            var loc6=null;
            RuneToolTipUtil._curItemData = arg1;
            if (arg1 == null || arg1.itemInfo == null || arg1.itemInfo.item == null) 
            {
                return arg1;
            }
            var loc1=arg1.itemInfo.item.career;
            if (loc1 == ECareer._ECareerNewPlayer || loc1 == ECareer._ECareerNo) 
            {
                return arg1;
            }
            var loc2=RuneToolTipUtil.getRuneCareer(loc1);
            var loc3=Cache.instance.role.careerBasic;
            var loc4;
            if ((loc4 = SecondCareerUtil.getSecondCareerItemData(loc2, loc3, arg1)) == null) 
            {
                return arg1;
            }
            RuneToolTipUtil._curItemData = loc4;
            var loc5;
            if ((loc5 = Cache.instance.pack.runePackCache.getItemsByJudge(RuneToolTipUtil.getMyEquipedRune, true)) == null || loc5.length == 0) 
            {
                return arg1;
            }
            if (Cache.instance.role.careerBasic != Cache.instance.role.careerEnabled) 
            {
                if ((loc6 = SecondCareerUtil.getSecondCareerItemData(Cache.instance.role.careerBasic, Cache.instance.role.careerSecond, loc5[0] as ItemData)) != null) 
                {
                    return loc6;
                }
            }
            return loc5[0] as ItemData;
        }

        public static getMyEquipedRune(arg1: ItemData): Boolean
        {
            if (RuneToolTipUtil._curItemData.itemInfo.item.category != arg1.itemInfo.item.category) 
            {
                return false;
            }
            if (RuneToolTipUtil._curItemData.itemInfo.item.type != arg1.itemInfo.item.type) 
            {
                return false;
            }
            if (RuneToolTipUtil._curItemData.itemInfo.item.effect != arg1.itemInfo.item.effect) 
            {
                return false;
            }
            return true;
        }

        public static getRuneCareer(arg1: int): int
        {
            var loc1=CareerUtil.getEquipCareerArray(arg1);
            if (loc1 == null || loc1.length == 0) 
            {
                return ECareer._ECareerNo;
            }
            if (loc1.length == 1) 
            {
                return CareerUtil.getGradeCareer(int(loc1[0]));
            }
            return ECareer._ECareerNo;
        }

        /* internal */ static /* var */_curItemData: ItemData;
    }
